idx_spi <- function(.scale, .dist, ...){
...
data |> # data contain `prcp`
aggregate(.var = prcp, # step 1: temporal aggregation
.scale = .scale)|> # aggregate `prcp` with time scale
# `.scale` to create `.agg`, by default
dist_fit(.dist = .dist, # step 2: distribution fit
.method = "lmoms", # using L-moment to fit `.dist`
.var = .agg) |> # distribution on `.agg`
augment(.var = .agg) # step 3: normalising
# find the normal density for `.agg`
}